<div class="breadcrum">
    <p>
        <a href="{$config->site_url('laporan/barang')}">Reporting</a>
        <span></span>
        <small>Barang</small>
        <span></span>
    </p>
    <div class="clear"></div>
</div>

<div class="dashboard-container">
    <table width="100%" class="table-dashboard">
        <tbody>
            <tr>
                <!-- <th width="5%">No</th> -->
                <th width="20%">Group Aset</th>
                <th width="30%">Kategori</th>
                <th width="20%">Jumlah Asset</th>
                <th width="30%">Total Nilai Asset</th>
            </tr>
            {assign var="gpbarang_cd_tmp" value=""}
            {assign var="gpbarang_name_tmp" value=""}
            {assign var="tot_jum" value= 0}
            {assign var="tot_nilai" value=0}
            {foreach from=$rs_id key=no item=result}  

            {if $gpbarang_cd_tmp|default:'' neq {$result.gpbarang_cd}}
            {assign var="gpbarang_name_tmp" value=$result.gpbarang_name} 
            {assign var="gpbarang_cd_tmp" value=$result.gpbarang_cd}
            {else}
            {assign var="gpbarang_name_tmp" value=""}
            {/if}

            {assign var="tot_jum" value=$tot_jum+$result.total_barang}
            {assign var="tot_nilai" value=$tot_nilai+$result.total_nilai_buku}
            <tr>
                <td class="title">{$gpbarang_name_tmp}</td>
                <td class="group">
                    <a href="{$config->site_url('laporan/barang/nilaiaset_detail/')}/{$result.kategoribarang_cd}">
                        <span class="blue">{$result.kategoribarang_name}</span>
                    </a>
                </td>
                <td><span class="count">{$result.total_barang|default:'0'}</span><span class="label">Barang</span></td>
                <td><span class="count">{$result.total_nilai_buku|default:'0'|number_format:2:",":"."}</span><span class="label">Rupiah</span></td>
            </tr>         
            {foreachelse}            
            <tr>
                <td colspan="4">Data masih kosong</td>
            </tr>
            {/foreach}
            <tr>
                <td class="title" style="color:#CC181E;">Total</td>
                <td></td>
                <td>
                    <span class="count" style="color:#CC181E;">{$tot_jum|default:'0'}</span>
                    <span class="label">Barang</span>
                </td>
                <td>
                    <span class="count" style="color:#CC181E;">{$tot_nilai|default:'0'|number_format:2:",":"."}</span>
                    <span class="label">Rupiah</span>
                </td>
            </tr>
        </tbody>
    </table>
</div>